#include "XpmTermDocControl.h"
#include "dal/DocXmlAccess.h"

namespace xpm {

	XpmTermDocControl::XpmTermDocControl(conex::TermFactory* termFactory): _termFactory(termFactory)  {
		_xmlaccess = new DocXmlAccess(_termFactory->termControl("en"));
	}
	XpmTermDocControl::~XpmTermDocControl() {
		if(_xmlaccess) {
			delete _xmlaccess;
			_xmlaccess = 0;
		}
	}
	void XpmTermDocControl::OpenDoc(string filename) {
		_doc.Clear();
		_doc.setLang("en");
		_xmlaccess->SetFilename(filename.c_str());
		_xmlaccess->Load(_doc);
		return ;
	}
	int XpmTermDocControl::SaveDoc(string filename) {
		_xmlaccess->SetFilename(filename.c_str());
		_xmlaccess->Save(_doc);
		return true;
	}

}